// 发货相关接口
import request from '@/utils/request'
import { withPrefix, Method } from '@/service/index'

/**
 * 查询发货申请列表
 */
export const getDeliveryApplyList = (data) => {
  return request({
    url: withPrefix('/api/international/deliveryApply/v1/list'),
    method: Method.POST,
    data: { ...data, nodeHandleSystem: 'finance' }
  })
}

/**
 * 审批
 */
export const updateAgree = (data) => {
  return request({
    url: withPrefix('/api/international/deliveryApply/v1/updateAgree'),
    method: Method.POST,
    data
  })
}

/**
 * 驳回
 */
export const updateFail = (data) => {
  return request({
    url: withPrefix('/api/international/deliveryApply/v1/updateFail'),
    method: Method.POST,
    data
  })
}

/**
 * 申请详情
 */
export const getDeliveryDetail = (data) => {
  return request({
    url: withPrefix('/api/international/deliveryApply/v1/view'),
    method: Method.POST,
    data
  })
}

/**
 * 上传附件
 */
export const uploadAttachment = (data) => {
  return request({
    url: withPrefix('/api/international/deliveryApply/v1/updateAttachment'),
    method: Method.POST,
    data
  })
}

// 上传文件获取url接口
export const getFileUrl = data => {
  return request({
    url: withPrefix('/api/international/file/v1/upload'),
    method: Method.POST,
    data
  })
}

// 删除附件接口
export const deleteAttachMent = data => {
  return request({
    url: withPrefix('/api/international/attachment/v1/delete'),
    method: Method.POST,
    data
  })
}

// 发货申请出货物流详情接口
export const outboundDetailInterface = data => {
  return request({
    url: withPrefix('/api/international/outbound/v1/queryByDeliveryApplyId'),
    method: Method.POST,
    data
  })
}

// 出库单删除附件接口
export const deleteOutboundAttachment = data => {
  return request({
    url: withPrefix('/api/international/outbound/v1/deleteAttachments'),
    method: Method.POST,
    data
  })
}

// 收发货信息变更记录列表
export const deliveryRecordList = data => {
  return request({
    url: withPrefix('/api/international/deliveryApplyDeliverInfo/v1/getPageList'),
    method: Method.POST,
    data
  })
}

